package com.pgybook.db.entity.mapper;

import org.springframework.stereotype.Repository;
import com.pgybook.db.entity.domain.DepositDailyAnalysis;
import com.pgybook.db.entity.domain.DepositDailyAnalysisEx;
import com.pgybook.db.entity.domain.DepositDailyAnalysisKey;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Repository
public interface DepositDailyAnalysisMapper {
    int countByExample(DepositDailyAnalysisEx example);

    int deleteByExample(DepositDailyAnalysisEx example);

    @Delete({
            "delete from depositdailyanalysis",
            "where BZDAY = #{bzday,jdbcType=DATE}",
            "and LIBID = #{libid,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(DepositDailyAnalysisKey key);

    @Insert({
            "insert into depositdailyanalysis (BZDAY, LIBID, ",
            "NEWCUSTDEPOSIT, UPGRADECUSTDEPOSIT, ",
            "WITHDRAWDEPOSIT, RECHARGENUM, ",
            "RECHARGETOTAL)",
            "values (#{bzday,jdbcType=DATE}, #{libid,jdbcType=INTEGER}, ",
            "#{newcustdeposit,jdbcType=DECIMAL}, #{upgradecustdeposit,jdbcType=DECIMAL}, ",
            "#{withdrawdeposit,jdbcType=DECIMAL}, #{rechargenum,jdbcType=BIGINT}, ",
            "#{rechargetotal,jdbcType=DECIMAL})"
    })
    int insert(DepositDailyAnalysis record);

    int insertSelective(DepositDailyAnalysis record);

    List<DepositDailyAnalysis> selectByExample(DepositDailyAnalysisEx example);

    @Select({
            "select",
            "BZDAY, LIBID, NEWCUSTDEPOSIT, UPGRADECUSTDEPOSIT, WITHDRAWDEPOSIT, RECHARGENUM, ",
            "RECHARGETOTAL",
            "from depositdailyanalysis",
            "where BZDAY = #{bzday,jdbcType=DATE}",
            "and LIBID = #{libid,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    DepositDailyAnalysis selectByPrimaryKey(DepositDailyAnalysisKey key);

    int updateByExampleSelective(@Param("record") DepositDailyAnalysis record, @Param("example") DepositDailyAnalysisEx example);

    int updateByExample(@Param("record") DepositDailyAnalysis record, @Param("example") DepositDailyAnalysisEx example);

    int updateByPrimaryKeySelective(DepositDailyAnalysis record);

    @Update({
            "update depositdailyanalysis",
            "set NEWCUSTDEPOSIT = #{newcustdeposit,jdbcType=DECIMAL},",
            "UPGRADECUSTDEPOSIT = #{upgradecustdeposit,jdbcType=DECIMAL},",
            "WITHDRAWDEPOSIT = #{withdrawdeposit,jdbcType=DECIMAL},",
            "RECHARGENUM = #{rechargenum,jdbcType=BIGINT},",
            "RECHARGETOTAL = #{rechargetotal,jdbcType=DECIMAL}",
            "where BZDAY = #{bzday,jdbcType=DATE}",
            "and LIBID = #{libid,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(DepositDailyAnalysis record);
}
